/*
 *
 *  * Copyright (c) 2016. For Intelligent Group.
 *
 */

package com.intelligent.ispc.foundation.chart.data.xy;

import org.jfree.data.xy.AbstractIntervalXYDataset;
import org.jfree.data.xy.IntervalXYDataset;

/**
 * Created by Peter on 2016/9/14.
 */
public class SimpleIntervalXYDataset extends AbstractIntervalXYDataset implements IntervalXYDataset {
    private double[] xStart;
    private double[] xEnd;
    private double[] yValues;

    public void SimpleIntervalXYDataset(double[] xStart, double[] xEnd, double[] yValues) {
        this.xStart = xStart;
        this.xEnd = xEnd;
        this.yValues = yValues;
    }

    @Override
    public int getSeriesCount() {
        return 1;
    }

    @Override
    public Comparable getSeriesKey(int series) {
        return "Series 1";
    }

    @Override
    public Number getStartX(int series, int item) {
        return xStart[item];
    }

    @Override
    public Number getEndX(int series, int item) {
        return xEnd[item];
    }

    @Override
    public Number getStartY(int series, int item) {
        return yValues[item];
    }

    @Override
    public Number getEndY(int series, int item) {
        return yValues[item];
    }

    @Override
    public int getItemCount(int series) {
        return yValues.length;
    }

    @Override
    public Number getX(int series, int item) {
        return xStart[item];
    }

    @Override
    public Number getY(int series, int item) {
        return yValues[item];
    }

    public double[] getxStart() {
        return xStart;
    }

    public void setxStart(double[] xStart) {
        this.xStart = xStart;
    }

    public double[] getxEnd() {
        return xEnd;
    }

    public void setxEnd(double[] xEnd) {
        this.xEnd = xEnd;
    }

    public double[] getyValues() {
        return yValues;
    }

    public void setyValues(double[] yValues) {
        this.yValues = yValues;
    }
}
